#pragma once
#ifndef IO_STREAMWRITER_H
#define IO_STREAMWRITER_H
//------------------------------------------------------------------------------
/**
    @class Core::StreamWriter
  
    Stream writer classes provide a specialized write-interface for a stream.
    This is the abstract base class for all stream writers. It is possible
    to attach any number of readers and writers to the same stream.

    (C) 2006 Radon Labs GmbH
*/
#include "stream.h"

//------------------------------------------------------------------------------
namespace GBase
{
	class StreamWriter
	{
	public:
		/// constructor
		StreamWriter();
		/// destructor
		virtual ~StreamWriter();
		/// set stream to write to
		void SetStream(Stream* s, bool delStream);
		/// get currently set stream 
		Stream* GetStream();
		/// return true if a stream is set
		bool HasStream() const;
		/// begin reading from the stream
		virtual bool Open();
		/// end reading from the stream
		virtual void Close();
		/// return true if currently open
		bool IsOpen() const;

	protected:
		Stream* stream;
		bool deleteStream;
		bool isOpen;
		bool streamWasOpen;
	};

	//------------------------------------------------------------------------------
	/**
	*/
	inline
	bool
	StreamWriter::IsOpen() const
	{
		return this->isOpen;
	}

} // namespace Core
//------------------------------------------------------------------------------
#endif
